package com.lhdx.practical.dao;

import com.lhdx.practical.bean.Task;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TaskDao extends CrudRepository<Task,Long> {
    Task findById(long id);
    void deleteById(long id);
    List<Task> findAllByAuthoridAndTypeAndSidAndMidAndGradeid(long authorid,int type,long sid,long mid,long gradeid);

    List<Task> findAllByTypeAndSidAndMidAndGradeid(int type,long sid,long mid,long gradeid);
    Page<Task> findAll(Specification<Task> spec, Pageable pageable);

    List<Task> findAllByGroupidAndType(long groupid,int type);

    List<Task> findAllByGradeidAndType(long gradeid,int type);

    int countAllBySidAndType(long sid,int type);
}
